import java.util.*;

public class TreeSetTest {
    public static void main(String[] args) {
        /*TreeSet<Person> set = new TreeSet();
        set.add(new Person("hjy",22));
        set.add(new Person("zl",23));
        set.add(new Person("lqz",21));
        Person p1 = new Person("jjj",111);
        Person p2 = new Person("sss",222);
        for(Person o : set) {
            System.out.println(o);
        }
        Set set1 = new TreeSet();
        set1.add(p1);
        System.out.println(p1);
        System.out.println("+++++++++++++++++++++++++++++++");
       // System.out.println(set.get(2));
        List<Person> l  = new ArrayList<>(set);
        for (Person p: l) {
            System.out.println(p);
        }
        System.out.println(l.get(2));
        HashMap<Person,Integer> h = new HashMap<>();
        h.put(p1,1111111111);
        h.put(p2,333333);
        //System.out.println();
        Set<Person> set2 = h.keySet();

        for (Person k: set2) {
            System.out.println(k+"->"+h.get(k));
        }

*/
        HashMap hashMap = new HashMap();
        Person p1 = new Person();
        Person p2 = new Person();
        Person p3 = new Person();
        hashMap.put(p1,1111111);
        hashMap.put(p2,3333333);
        hashMap.put(p3,22222);
        //hashMap.remove(p1);
        System.out.println(hashMap.size());
        








    }

}
class Person implements Comparable<Person>{
    String name;
    int age;

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public int compareTo(Person o) {

        return this.age - o.age;
    }

    @Override
    public String toString() {
        return "name:"+name+"  age:"+age;
    }

}
